<script src="<?= base_url(); ?>third_party/ckeditor/ckeditor.js"></script>

<section class="wrapper">
	<!-- page start-->
	<section class="panel">
		<header class="panel-heading"> CMS MANAGEMENT </header>
		<div class="panel-body">
			<form class="form-horizontal" role="form" name="cat" method="POST"
				action="<?= base_url(); ?>secure/cms/cms_management/get_cms">
				
				<?php if($this->session->flashdata('message'))
				{
					$msg=$this->session->flashdata('message');
					echo '<font color="red">'.$msg.'</font>';
				}
				?>
				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Template Type</label>
					<div class="col-lg-3">
						<select class="form-control" name="cms" onchange="this.form.submit()">
							<option selected="selected" value="">- - - Select Template-
								- -</option>
								<?php foreach($cms as $cms):?>
								<option value="<?= $cms->title;?>">
									<?= $cms->title;?>
								</option>
								<?php endforeach;?>
						</select>
					</div>
				</div>


			</form>
		</div>
		<!-- End of Body Panel -->
	</section>
	<!-- page end-->
	
	<?php if (isset($cms_id)) { ?>
	<section class="panel">
					<header class="panel-heading"> CMS MANAGEMENT : <?= $cms->title; ?> </header>
					<div class="panel-body">
						<form class="form-horizontal" role="form"
						name="keyword" method="POST"
				action="<?= base_url(); ?>secure/cms/cms_management/update_cms">
<?php
					$this->session->flashdata('message'); {
						$msg = $this->session->flashdata('message');
						echo '<font color="red">' . $msg . '</font>';
					}
					?>
						<div class="form-group">
								<label for="input" class="col-lg-2 control-label">Position</label>
								<div class="col-lg-3">
									<select class="form-control" name="position">
									
									<option value="0"
									<?php if ($cms->position=="0") echo 'selected="selected"';?>>Both</option>

									<option value="1"
									<?php if ($cms->position=="1") echo 'selected="selected"';?>>Top</option>
									<option value="2"
									<?php if ($cms->position=="2") echo 'selected="selected"';?>>Bottom</option>

							</select>
								</div>
							</div>


							<div class="form-group">
								<label for="input" class="col-lg-2 control-label">Title</label>
								<div class="col-lg-8">
									<input type="text" class="form-control" id="title" name="title" value="<?= $cms->title;?>" 
										>
								</div>
							</div>

							<div class="form-group">
								<label for="input" class="col-lg-2 control-label">Url</label>
								<div class="col-lg-8">
									<input type="text" class="form-control" id="url" name="url" value="<?= $cms->url;?>" 
										>
								</div>
							</div>
							
							<div class="form-group">
								<label for="input" class="col-lg-2 control-label">Meta Title</label>
								<div class="col-lg-8">
									<input type="text" class="form-control" id="meta_title" name="meta_title" value="<?= $cms->meta_title; ?>" 
										>
								</div>
							</div>
							
							<div class="form-group">
								<label for="input" class="col-lg-2 control-label">Meta
									Keyword</label>
								<div class="col-lg-8">
									<textarea name="meta_keyword" id="meta_keyword" class="form-control" rows="3">
									<?= $cms->meta_keyword; ?>
									</textarea>
								</div>
							</div>
							<div class="form-group">
								<label for="input" class="col-lg-2 control-label">Meta
									Description</label>
								<div class="col-lg-8">
									<textarea name="meta_description" id="meta_description" class="form-control" rows="3">
									<?= $cms->meta_description; ?>
									</textarea>
								</div>
							</div>

							<div class="form-group">
								<label for="input" class="col-lg-2 control-label">Template Type</label>
								<div class="col-lg-8">

									<textarea class="form-control ckeditor" id="cmscontent" name="cmscontent" rows="6">
									<?= $cms->description;?>
									</textarea>
									</textarea> <script
									type="text/javascript">
                                //<![CDATA[
                                CKEDITOR.replace( 'cmscontent',
                                {
                                    skin : 'v2',
                                    enterMode : CKEDITOR.ENTER_DIV,
                                    toolbar :
                                        [
                                        [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
                                        [ 'UIColor' ]
                                    ]
                                });
                                //]]>
                            </script>

								</div>
							</div>

							<div class="form-group">
								<div class="col-lg-offset-2 col-lg-8">
								<input name="cms_id" type="hidden" size="0"
								value="<?= $cms_id; ?>" />
								
									<input type="submit" class="pull-right btn btn-info" name="cms_update"
							<?php if($this->config->item('mode')=='DEMO'){?>onclick="alert ('Sorry! Not allowed in demo mode '); return false;" <?} else?>onclick="return confirm('Are you sure ?');" value="Update"
								onclick="nicEditors.findEditor('cmscontent').saveContent();return confirm('Are you sure you want to update?');" />
								</div>
							</div>


						</form>
					</div>
					<!-- End of Body Panel -->
				</section>
				<!-- page end-->
	<?php }?>
</section>


				











